import fetch, { BaseResponse, RequestContentType } from './index'
import {
  ReqBaseInfo,
  ResBaseInfo,
  ResProvinceRelationInfo,
  ReqProvinceRelationInfo,
  ResProvince,
} from '@/types/fillLink'
/**
 * 获取省份基础数据
 * @param param Partial<AddressParam>
 * @returns BaseResponse<any>
 */
export async function getProvinceList(): Promise<BaseResponse<ResProvince>> {
  const { data } = await fetch.get<BaseResponse<ResProvince>>('/province/list', {})
  return data
}

/**
 * 获取省份-年份-科目关系数据
 * @param param Partial<AddressParam>
 * @returns BaseResponse<any>
 */
export async function getSubjectByProvince(
  param: ReqProvinceRelationInfo,
): Promise<BaseResponse<ResProvinceRelationInfo>> {
  const { data } = await fetch.get<BaseResponse<ResProvinceRelationInfo>>('/subject-by-province', {
    ...param,
  })
  return data
}

/**
 * 提交诊断表单
 * @param param Partial<AddressParam>
 * @returns BaseResponse<any>
 */
export async function diagnosis(param: ReqBaseInfo): Promise<BaseResponse<ResBaseInfo>> {
  const { data } = await fetch.post<BaseResponse<ResBaseInfo>>('/diagnosis', {
    ...param,
  })
  return data
}
